Skip to content

Conversation

@BurnWW
Copy link

@BurnWW BurnWW commented Aug 30, 2025

The current contract interface requires transferring a large ABI file with each call. I am now submitting a new dry api for more lightweight contract queries.

@BurnWW BurnWW requested a review from a team as a code owner August 30, 2025 12:33
@cla-bot-2021
Copy link

cla-bot-2021 bot commented Aug 30, 2025

User @BurnWW, please sign the CLA here.

@BurnWW BurnWW changed the title add ink contract dry run add ink v6 contract dry run Aug 30, 2025
@TarikGul TarikGul self-requested a review September 1, 2025 12:42
@TarikGul
Copy link
Member

TarikGul commented Sep 1, 2025

Thank you for the PR, I promise to get to this sometime in the next 2 days!

Copy link
Collaborator

@andrew-ifrita andrew-ifrita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long delay here. I have a handful of comments and concerns that need to be addressed before this can be approved and merged.

Aside from the specific points mentioned in the code

  1. The title mentions "ink! v6" but there is nothing version specific here. The PR description might just need a little more context.
  2. There are no tests for the new endpoint. This is a hard blocker.
  3. There are no docs for the new endpoint. This is another hard blocker

* @param _req
* @param res
*/
private dryRun: IPostRequestHandler<IBodyContractMetadata, IContractDryParams> = async (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we have IPostRequestHandler but it is mounted as a GET handler with

this.safeMountAsyncGetHandlers([['/dry-run', this.dryRun as RequestHandler]]);

protected initRoutes(): void {
this.router.use(this.path, validateAddress);
this.safeMountAsyncPostHandlers([['/query', this.callContractQuery as RequestHandler]]);
this.safeMountAsyncGetHandlers([['/dry-run', this.dryRun as RequestHandler]]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is returning IPostRequestHandler while being mounted as a GET handler.

Which one is it?

{ params: { address }, query: { caller, payValue = '0', inputData } },
res,
): Promise<void> => {
const dryRunResult = await this.api.call.reviveApi.call(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a check if reviveApi is available as well as graceful handling if it is not.

Comment on lines +74 to +76
caller: string;
payValue: string;
inputData: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any of these values being validated anywhere which can lead to some bugs and poor UX / hard to debug issues.


export interface IContractDryParams extends Query {
caller: string;
payValue: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is meant to be optional, based on the default values that is has above.

};

/**
* Send a message call to a dry run contract. It defaults to get if nothing is inputted.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It defaults to get if nothing is inputted.

Personally this is a bit hard to understand on a first read through. Maybe something like

Execute a dry run contract call without requiring the full ABI

is better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants